package Utils;

import android.content.Context;
import android.os.Handler;
import android.widget.Toast;

import app.MyApplication;

/**
 * Created by 任科全 on 2017/3/13.
 */

public class MyToast {
    static Toast mToast;


    public static void showToast(String message) {
        final Toast mToast = Toast.makeText(MyApplication.getInstance(), message, Toast.LENGTH_LONG);
        mToast.show();

    }

    //请求返回 msg为null
    public static void showAppVersionError(Context context) {

        String message = "版本校验失败，请检查网络后重试";
        mToast = Toast.makeText(context, message, Toast.LENGTH_LONG);
        mToast.show();

    }


    //请求返回 failed
    public static void showNullObjectError(Context context) {

        String message = "加载失败";
        mToast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
        mToast.show();

    }

    //请求返回 数据条数为0
    public static void showNoDate(Context context) {

        String message = "暂无更多数据";
        mToast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
        mToast.show();

    }

    //请求返回 数据条数为0
    public static void showUpDateFail(Context context) {

        String message = "字典表更新失败，请重新更新";
        mToast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
        mToast.show();

    }

    //请求返回 数据条数为0
    public static void showFail() {

//        String message = "数据加载失败，请重试";
//        mToast = Toast.makeText(MyApplication.getInstance(), message, Toast.LENGTH_SHORT);
//        mToast.show();
        MyApplication.showNetError();

    }

    //正式计划作废成功
    public static void showDestorySuccess() {

        String message = "废除计划成功";
        mToast = Toast.makeText(MyApplication.getInstance(), message, Toast.LENGTH_SHORT);
        mToast.show();

    }

    //正式计划回复成功
    public static void showRecoverySuccess() {

        String message = "废除计划成功";
        mToast = Toast.makeText(MyApplication.getInstance(), message, Toast.LENGTH_SHORT);
        mToast.show();

    }


    private Toast getToast(String message) {
        return Toast.makeText(MyApplication.getInstance(), message, Toast.LENGTH_SHORT);
    }

}
